package com.example.mybatispractice.controller;

import com.example.mybatispractice.model.UserInfo;
import com.example.mybatispractice.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: hp
 * Date: 2025-01-15
 * Time: 19:21
 */
@RestController
@RequestMapping("/user")
public class UserController {
    @Autowired
    private UserService userService;
    @RequestMapping("/selectUserList")
    public List<UserInfo> selectUserList() {
        return userService.selectUserList();
    }

    @RequestMapping("/login")
    public boolean login(String userName,String password) {
        UserInfo userInfo = userService.selectUserByNameAndPassword(userName,password);
        if(userInfo == null) {
            return false;
        }
        return true;
    }

}
